/**
 * Created by Administrator on 2017/3/19.
 */
//import path from 'path'
//import HtmlWebpackPlugin from 'html-webpack-plugin'

const path = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
    devtool: 'eval-source-map',

    entry:  path.join(__dirname, "app/main.js"),
    output: {
        path: path.join(__dirname, "build"),
        filename: "bundle.js"
    },

    module: {
        loaders: [
            { test: /\.json$/, loader: "json-loader" },
            { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
            { test: /\.css$/, use:['style-loader', {loader: 'css-loader'}] },
            { test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, use: 'url-loader?name=assets/[name].[ext]&limit=10'}
        ]
    },

    devServer: {
        historyApiFallback: true,
        inline: true,
        contentBase: "./build",//本地服务器所加载的页面所在的目录
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(__dirname, "app/index.templ.html")//new 一个这个插件的实例，并传入相关的参数
        })
    ],
}